package com.css.dzj.dzjjcss.modules.todo.controller;

import com.css.dzj.dzjjcss.common.util.R;
import com.css.dzj.dzjjcss.modules.publicity.entity.PublicityEntity;
import com.css.dzj.dzjjcss.modules.publicity.service.PublicityService;
import com.querydsl.core.QueryResults;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/tbxx")
public class publictbxx {
    @Autowired
    private PublicityService pService;
    /**
     *列表
     */
    @GetMapping("/list")
    public R list(@RequestParam Integer pageSize, @RequestParam Integer pageNo){
        try{
            PageRequest pageRequest = PageRequest.of(pageNo-1,pageSize);
            QueryResults<PublicityEntity> Results =  pService.queryPage(pageRequest);
            System.out.println();
            return R.ok().put("data",Results);
        }catch (Exception e){
            e.printStackTrace();
            return R.error(e.getMessage());
        }
    }
}
